home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / misc / volume9 / uustatus < prev    next >
Encoding:
Text File  |  1989-12-07  |  41.4 KB  |  1,518 lines

  1. Newsgroups: comp.sources.misc
  2. organization: Deadly Force, Inc., aka Clint Eastwood School of Diplomacy
  3. keywords: uucp uustat HDB
  4. subject: v09i057: uustatus 1.1.f -- curses-oriented uustat (sort of)
  5. From: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  6. Reply-To: erc@khijol.UUCP (Edwin R. Carp)
  7.  
  8. Posting-number: Volume 9, Issue 57
  9. Submitted-by: erc@khijol.UUCP (Edwin R. Carp)
  10. Archive-name: uustatus
  11.  
  12. Here is a report of uustatus, which was posted about a year ago.  I mentioned
  13. it on the net a gew days ago, and have had lots of requests for it.
  14. ----------------------------------- cut here -----------------------------------
  15. #! /bin/sh
  16. # This is a shell archive.  Remove anything before this line, then unpack
  17. # it by saving it into a file and typing "sh file".  To overwrite existing
  18. # files, type "sh file -c".  You can also feed this as standard input via
  19. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  20. # will see the following message at the end:
  21. #        "End of shell archive."
  22. # Contents:  uustatus uustatus/Makefile uustatus/README
  23. #   uustatus/basename.fun uustatus/dirent.h uustatus/findpath.1
  24. #   uustatus/findpath.c uustatus/findpath.doc uustatus/findpath.prt
  25. #   uustatus/makedocs uustatus/strrep.fun uustatus/touch.fun
  26. #   uustatus/unback.c uustatus/uustatus.1 uustatus/uustatus.c
  27. #   uustatus/uustatus.doc uustatus/uustatus.h uustatus/uustatus.prt
  28. # Wrapped by erc@khijol on Mon Dec  4 01:40:49 1989
  29. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  30. if test ! -d uustatus ; then
  31.     echo shar: Creating directory \"uustatus\"
  32.     mkdir uustatus
  33. fi
  34. if test -f uustatus/Makefile -a "${1}" != "-c" ; then 
  35.   echo shar: Will not over-write existing file \"uustatus/Makefile\"
  36. else
  37. echo shar: Extracting \"uustatus/Makefile\" \(1255 characters\)
  38. sed "s/^X//" >uustatus/Makefile <<'END_OF_uustatus/Makefile'
  39. X#
  40. X#    Makefile for uustatus and findpath
  41. X#    ...by Robert J. Granvin
  42. X#    January 26, 1989
  43. X#
  44. X
  45. X
  46. X#
  47. X#    You will need to be root to make the install.
  48. X#
  49. X#    If you want uustatus to display sites marked as WRONG TIME TO CALL,
  50. X#    add -DWTTC to the FLAGS line.  (This is only valid for uustatus).
  51. X#
  52. X#    Add -DNEEDDIRENT to FLAGS if you don't have /usr/include/dirent.h,
  53. X#    or want to use the supplied dirent.h.
  54. X#
  55. X#    Define OWNER and GROUP to be the same as UUCPOWN and UUCPGRP as
  56. X#    defined in uustatus.h
  57. X#
  58. X#    Define BINDIR to where you want the binaries installed.
  59. X#
  60. X
  61. X# FLAGS=-O -DM_XENIX -DWTTC -DNEEDDIRENT
  62. XFLAGS=-O -DM_XENIX -DWTTC
  63. X# LIBS=-lcurses -ltermcap
  64. XLIBS=-lcurses -ldir
  65. XOWNER=uucp
  66. XGROUP=uucp
  67. XBINDIR=/usr/local/bin
  68. XCC=cc
  69. X
  70. X
  71. Xall:    uustatus findpath
  72. X
  73. X
  74. Xuustatus:    uustatus.c uustatus.h basename.fun touch.fun
  75. X    $(CC) $(FLAGS) -o uustatus uustatus.c $(LIBS)
  76. X
  77. Xfindpath:    findpath.c basename.fun strrep.fun
  78. X    $(CC) $(FLAGS) -o findpath findpath.c
  79. X
  80. Xclean:
  81. X    rm -f *.o core
  82. X
  83. Xclobber: clean
  84. X    rm -f uustatus findpath
  85. X
  86. Xinstall: all
  87. X    rm -f $(BINDIR)/uustatus $(BINDIR)/findpath
  88. X    strip uustatus
  89. X    strip findpath
  90. X    cp uustatus $(BINDIR)
  91. X    cp findpath $(BINDIR)
  92. X    chown $(OWNER) $(BINDIR)/uustatus
  93. X    chgrp $(GROUP) $(BINDIR)/uustatus
  94. X    chmod 4755 $(BINDIR)/uustatus
  95. X    chmod 755 $(BINDIR)/findpath
  96. X
  97. END_OF_uustatus/Makefile
  98. if test 1255 -ne `wc -c <uustatus/Makefile`; then
  99.     echo shar: \"uustatus/Makefile\" unpacked with wrong size!
  100. fi
  101. # end of overwriting check
  102. fi
  103. if test -f uustatus/README -a "${1}" != "-c" ; then 
  104.   echo shar: Will not over-write existing file \"uustatus/README\"
  105. else
  106. echo shar: Extracting \"uustatus/README\" \(6364 characters\)
  107. sed "s/^X//" >uustatus/README <<'END_OF_uustatus/README'
  108. Xuustatus - by Ed Carp
  109. X
  110. XChanges for version 1.1.f:
  111. X
  112. XUnder certain circumstances, the uucico log files may disappear, causing a core
  113. Xdump when attempting to read these files.  This has been fixed.  This only
  114. Xoccurs when uustatus is running and the uucico log file disappears, then a
  115. Xconversation is attempted.
  116. X
  117. XAlso works on AIX (tested on the PS/2, but should work for the RT and Rios).
  118. X
  119. XChanges for version 1.1.a:
  120. X
  121. XFixed minor bugs - (1) XENIX now properly works, thanks to Sandy,
  122. Xand (2) the Makefile was generously supplied by Robert J. Granvin.
  123. X
  124. XChanges for version 1.1:
  125. X
  126. Xuustatus now provides a realtime display of the uucico log file as the
  127. Xconversation is taking place (much like "tail -f" does, but it doesn't
  128. Xscroll the screen).  This only works for the first system that uustatus
  129. Xfinds that is engaging in a conversation.  An asterisk is placed by the
  130. Xstatus of the system to note that fact.
  131. X
  132. Xuustatus now displays the number of input and output files for each system.
  133. X
  134. XIf there does not exist a status file for a system, the system exists in the
  135. XSystems file, and there are files waiting to be transferred to that system,
  136. Xuustatus will create a dummy status file for that system.
  137. X
  138. XIf a system is currently engaged in a conversation, uustatus will display
  139. Xthe status of the system in reverse video.
  140. X
  141. XThere is now a #define for displaying system status on systems that 
  142. Xcurrently display WRONG TIME TO CALL messages.
  143. X
  144. XThanks to the following people for their suggestions and advice.  If y'all
  145. Xdon't see all of your suggestions implemented, please be patient.
  146. X
  147. XDoug Blair
  148. XGordon Moffett
  149. XJohan Vromans
  150. XRobert J. Granvin
  151. XSandy Zelkovitz
  152. X
  153. X
  154. XIntroduction
  155. X
  156. XHDB UUCP may be a dream to some, but for me it can be a real pain,
  157. Xkeeping up with everything that's happening on my system.  This simple
  158. X(relatively) program dynamically displays the status of your UUCP
  159. Xconnections for you, without you having to cd into all of those
  160. Xpesky directories.  It's also faster than uustat -m, and it's
  161. Xreal-time!
  162. X
  163. XThe best part about this mish-mash, however, is dirent.h.  I liked the
  164. XBSD/XENIX directory routines a lot, but didn't have them on my System V
  165. Xbox.  So, I hacked up a couple of routines that work just as well.
  166. Xopendir(), closedir(), and readdir() are all that are supported, but that
  167. Xwas (and still is) enough for most system programming applications.
  168. X
  169. XBTW, these routines are supported on most systems as of version 1.1.f.
  170. X
  171. XI also have a little gadget that will search your path for a program -
  172. Xhandy if you can get to a program (execute it), but need to know where the
  173. Xdumb thing is, and don't have the time to waste with "find `echo $PATH|tr ...
  174. Xstuff.  It's also MUCH faster, and it's included FREE!
  175. X
  176. XCompiling (you can also hack & use the Makefile):
  177. X
  178. X1.    cc -s -o uustatus uustatus.c -lcurses -ltermcap -O
  179. X    (or whatever libraries your system needs to support curses).
  180. X    cc -s -o findpath findpath.c -O
  181. X
  182. X2.    chown uucp uustatus;chmod 4755 uustatus
  183. X
  184. X
  185. XDocs:
  186. X    The manpage source is in uustatus.1, the nroff'ed output
  187. X    is in uustatus.prt, and the viewable output is in uustatus.doc.
  188. X    I used the -man macro package, so it should work on anyone's
  189. X    system.  If you make changes to the manpage, you can regenerate
  190. X    the docs by running "makedocs".
  191. X
  192. X
  193. XCustomization:
  194. X
  195. X    There are a number of tuneable parameters in uustatus.h
  196. X    that you can play with.
  197. X
  198. X/* #define WTTC */
  199. XIf you want to display status on systems that have this status posted,
  200. Xuncomment this define.
  201. X
  202. X#define STATUS "/usr/spool/uucp/.Status"
  203. XThis is where HDB UUCP puts its status files.  This should not be changed.
  204. X
  205. X#define SYSTEMS "/usr/lib/uucp/Systems"
  206. XThis is where the Systems file resides.  It must be readable by the owner
  207. Xof uustatus.
  208. X
  209. X#define UUCICO "/usr/spool/uucp/.Log/uucico"
  210. XThis is where the uucico log files live.
  211. X
  212. X#define LOCKFILE "/usr/spool/uucp/LCK..%s"
  213. XThis is where the lock files reside.  Don't touch this, either...
  214. X
  215. X#define WORKFILE "/usr/spool/uucp/%s"
  216. XThis is another one of those "don't touch me" parameters...
  217. X
  218. X#define EXPDAYS 14 /* connections older than X days will not be displayed */
  219. XIn this example, UUCP connections older than 14 days will not be displayed,
  220. Xregardless of their status.
  221. X
  222. X#define LOGON NO /* log expired systems? */
  223. XIf you want to log everything that goes on, set this to YES.  Generally
  224. Xuseless except for debugging.
  225. X
  226. X#define LOGFILE "/tmp/uuexp.log"
  227. XThis is where the log output goes.
  228. X
  229. X#define WAITMSG "WAIT"
  230. XStandard wait message.
  231. X
  232. X#define BWAITMSG "    " /* blank wait msg string */
  233. XThis must be the same length as the WAITMSG string (unless you want your screen
  234. Xto wind up looking strange).
  235. X
  236. X#define LLIMIT LINES-5
  237. XThis is how many lines of data we can display on the screen.  Generally
  238. Xa no-no to touch.
  239. X
  240. X#define FLIMIT 50 /* over this many files for site, we quit - must be < 100 */
  241. XWhen we scan the directories for work, we don't want to eat up too many
  242. Xsystem resources if we have a large directory with lots of stuff in it (not
  243. Xtoo uncommon for a large news feed), so after we read FLIMIT file names, we
  244. Xquit that directory and indicate that we have over that many files.
  245. XI set mine to 50, bt you can use a smaller number if your system is very
  246. XI/O bound (like you're running XENIX on an XT with a 65ms hard drive).
  247. X
  248. X#define UUCPOWN "uucp"
  249. X#define UUCPGRP "uucp"
  250. XThese should be set to "uucp".  These are used to create the status files
  251. Xif they do not exist.
  252. X
  253. X#define SLEEPTIME 10 /* time to sleep between samples */
  254. XTime to sleep between samples.  If you have a fast system with caching,
  255. Xyou might want to up this to make it more real-time.  If nothing ever
  256. Xhappens on your system and you want to leave this up in a window, you
  257. Xmight want to set it to something like 30 or 60.
  258. X
  259. X
  260. XThat's it!  Enjoy...and please remember -- if you make any changes or
  261. Xenhancements, please let me know (context diffs are OK).
  262. X
  263. XNo warranty expressed or implied.  I have tried as best I could to make sure
  264. Xthere are no bugs, but you know how that goes...at least it doesn't do
  265. Xanything but read files...
  266. X
  267. XEnhancements:
  268. X
  269. X    Well, a sorted display of systems would be nice...Any other
  270. X    suggestions?
  271. X----------------------------------- cut here -----------------------------------
  272. X           Ed Carp    N7EKG/5 (28.3-28.5)    erc@puzzle!khijol
  273. X           Austin,  Tx; (home) (512) 445-2044
  274. X           Snail Mail:  1800 E. Stassney  #1205
  275. X                        Austin, Tx  78744
  276. END_OF_uustatus/README
  277. if test 6364 -ne `wc -c <uustatus/README`; then
  278.     echo shar: \"uustatus/README\" unpacked with wrong size!
  279. fi
  280. # end of overwriting check
  281. fi
  282. if test -f uustatus/basename.fun -a "${1}" != "-c" ; then 
  283.   echo shar: Will not over-write existing file \"uustatus/basename.fun\"
  284. else
  285. echo shar: Extracting \"uustatus/basename.fun\" \(530 characters\)
  286. sed "s/^X//" >uustatus/basename.fun <<'END_OF_uustatus/basename.fun'
  287. X/*
  288. X*
  289. X* basename - returns base name of whatever's pass to it
  290. X*            strips off directory info
  291. X*            not for MSDOS
  292. X*
  293. X* Written by Edwin R. Carp
  294. X*
  295. X* Copyright...oh, why bother?
  296. X*
  297. X*/
  298. X
  299. Xchar *basename(string)
  300. Xchar *string;
  301. X{
  302. X   /* strips off directory information from string */
  303. X   char *strrchr();
  304. X   static char outstr[256];
  305. X   char *target, *start;
  306. X
  307. X   start = strrchr(string, '/'); /* find last slash */
  308. X   if(start == NULL) return(string);
  309. X   start++; /* bump past / */
  310. X   strcpy(outstr, start);
  311. X   return(outstr);
  312. X}
  313. END_OF_uustatus/basename.fun
  314. if test 530 -ne `wc -c <uustatus/basename.fun`; then
  315.     echo shar: \"uustatus/basename.fun\" unpacked with wrong size!
  316. fi
  317. # end of overwriting check
  318. fi
  319. if test -f uustatus/dirent.h -a "${1}" != "-c" ; then 
  320.   echo shar: Will not over-write existing file \"uustatus/dirent.h\"
  321. else
  322. echo shar: Extracting \"uustatus/dirent.h\" \(559 characters\)
  323. sed "s/^X//" >uustatus/dirent.h <<'END_OF_uustatus/dirent.h'
  324. X/*
  325. X*
  326. X* /usr/include/dirent.h for SYS V (AT&T)
  327. X*
  328. X* Copyright 1989 by Edwin R. Carp
  329. X*
  330. X* kludgy, but it works...
  331. X*
  332. X*/
  333. X
  334. X#define DIR FILE
  335. X#define dirent direct
  336. X#include <sys/dir.h>
  337. Xstatic struct direct wdp;
  338. X
  339. XDIR *opendir(name)
  340. Xchar *name;
  341. X{
  342. X   return(fopen(name, "r"));
  343. X}
  344. X
  345. Xstruct direct *readdir(dp)
  346. XDIR *dp;
  347. X{
  348. Xint ret;
  349. X
  350. X   while(1)
  351. X   {
  352. X      ret=fread(&wdp, 1, sizeof(struct direct), dp);
  353. X      if(ret < sizeof(struct dirent)) return((struct direct *)NULL);
  354. X      if(wdp.d_ino == 0) continue;
  355. X      return(&wdp);
  356. X   }
  357. X}
  358. X
  359. Xclosedir(dp)
  360. XDIR *dp;
  361. X{
  362. X   fclose(dp);
  363. X}
  364. END_OF_uustatus/dirent.h
  365. if test 559 -ne `wc -c <uustatus/dirent.h`; then
  366.     echo shar: \"uustatus/dirent.h\" unpacked with wrong size!
  367. fi
  368. # end of overwriting check
  369. fi
  370. if test -f uustatus/findpath.1 -a "${1}" != "-c" ; then 
  371.   echo shar: Will not over-write existing file \"uustatus/findpath.1\"
  372. else
  373. echo shar: Extracting \"uustatus/findpath.1\" \(804 characters\)
  374. sed "s/^X//" >uustatus/findpath.1 <<'END_OF_uustatus/findpath.1'
  375. X.TH FINDPATH 1
  376. X.SH NAME
  377. Xfindpath \- find file in path
  378. Xpath \- display path directories
  379. X.SH SYNOPSIS
  380. X/usr/local/bin/findpath
  381. X.I file
  382. X.SH DESCRIPTION
  383. X.I Findpath
  384. Xwill report on the location of
  385. X.I file,
  386. Xsearching every directory in the path (as defined in the
  387. X$PATH variable), much like the operating system does when searching
  388. X$PATH to execute a program.  It is handy for finding out where in your path
  389. Xa command resides.
  390. X.PP
  391. X.I Findpath
  392. Xaccepts metacharacters (which must be escaped to prevent interpretation by
  393. Xthe shell) according to the rules listed in
  394. X.I regcmp(3).
  395. X.PP
  396. X.I Findpath
  397. Xis linked to
  398. X.I path,
  399. Xwhich simply displays a list of directories to be searched.  It is much
  400. Xfaster than 'echo $PATH|tr ":" " "'.
  401. X.SH SEE ALSO
  402. Xcsh(1), ed(1), regcmp(3).
  403. X.SH CREDITS
  404. XThis utility was written by Ed Carp.
  405. END_OF_uustatus/findpath.1
  406. if test 804 -ne `wc -c <uustatus/findpath.1`; then
  407.     echo shar: \"uustatus/findpath.1\" unpacked with wrong size!
  408. fi
  409. # end of overwriting check
  410. fi
  411. if test -f uustatus/findpath.c -a "${1}" != "-c" ; then 
  412.   echo shar: Will not over-write existing file \"uustatus/findpath.c\"
  413. else
  414. echo shar: Extracting \"uustatus/findpath.c\" \(2490 characters\)
  415. sed "s/^X//" >uustatus/findpath.c <<'END_OF_uustatus/findpath.c'
  416. Xstatic char *sccsid = "%Z% %M% %I%    %G% %U%";
  417. X/*
  418. X*
  419. X* findpath - find a command in a path
  420. X*     path - list directories searched in path
  421. X*
  422. X* usage: findpath command(s)
  423. X*            path
  424. X*
  425. X* Written by Ed Carp
  426. X*
  427. X*/
  428. X#include <stdio.h>
  429. X#ifndef BSD
  430. X#include <string.h>
  431. X#else
  432. X#include <strings.h>
  433. X#endif
  434. X#include <sys/types.h>
  435. X#ifdef hpux || M_XENIX
  436. X#include <sys/ndir.h>
  437. X#define dirent direct
  438. X#else
  439. X#include <dirent.h>
  440. X#endif
  441. X#include "basename.fun"
  442. X#include "strrep.fun"
  443. X
  444. X#define CHARS "*[].^$-+{}()"
  445. X
  446. Xchar *getenv(), *regcmp(), *regex();
  447. X
  448. Xmain(argc, argv)
  449. Xint argc;
  450. Xchar **argv;
  451. X{
  452. X   DIR *d;
  453. X   struct dirent *dire;
  454. X   char *dir, *ptr, *ptr2, path[512], home[64], scr[512];
  455. X   char *re;
  456. X   int i=1, vflag=0, pflag=0, rflag=0;
  457. X
  458. X   if(strcmp("path", basename(argv[0])) == 0)
  459. X   {
  460. X      pflag = 1;
  461. X      vflag = 1;
  462. X   }
  463. X   if(argc < 2 && pflag == 0)
  464. X   {
  465. X      fprintf(stderr, "usage: findpath command(s)...\n");
  466. X      exit(1);
  467. X   }
  468. X   if((dir=getenv("path")) == (char *)NULL)
  469. X   {
  470. X      if((dir=getenv("PATH")) == (char *)NULL)
  471. X      {
  472. X         fprintf(stderr, "PATH not set!\n");
  473. X         exit(1);
  474. X      }
  475. X   }
  476. X   /* expand ~ in path to $HOME */
  477. X   strcpy(home, getenv("HOME"));
  478. X   if(home != (char *)EOF)
  479. X   {
  480. X      while((ptr=strrep("~", home, dir)) != (char *)EOF)
  481. X      {
  482. X         strcpy(dir, ptr);
  483. X      }
  484. X   }
  485. X   strcpy(path, dir); /* save it away */
  486. X   ptr = path;
  487. X   if(strpbrk(argv[i], CHARS) != (char *)NULL) rflag = 1;
  488. X   /* printf("DEBUG: rflag = %d\n", rflag); */
  489. X   /* printf("DEBUG: argv[i] = %s\n", argv[i]); */
  490. X   strcpy(scr, "^");
  491. X   strcat(scr, argv[i]);
  492. X   /* printf("DEBUG: scr = %s\n", scr); */
  493. X   if(rflag)
  494. X   {
  495. X      if((char *)NULL == (re = regcmp(scr, 0)))
  496. X      {
  497. X         puts("regcmp: Incorrect argument!");
  498. X         exit(1);
  499. X      }
  500. X   }
  501. X   while((dir=strtok(ptr, ":")) != (char *)NULL)
  502. X   {
  503. X      ptr = NULL;
  504. X      if(!pflag)
  505. X      {
  506. X         if((d=opendir(dir)) == (DIR *)NULL)
  507. X         {
  508. X            perror(dir);
  509. X            continue;
  510. X         }
  511. X      }
  512. X      if(vflag) printf("%s\n", dir);
  513. X      if(!pflag)
  514. X      {
  515. X         while((dire=readdir(d)) != (struct dirent *)NULL)
  516. X         {
  517. X            if(rflag)
  518. X            {
  519. X               if((ptr2=regex(re, dire->d_name)) != (char *)NULL)
  520. X                  printf("%s/%s\n", dir, dire->d_name);
  521. X            }
  522. X            else
  523. X               if(strcmp(dire->d_name, argv[i]) == 0)
  524. X                  printf("%s/%s\n", dir, dire->d_name);
  525. X         }
  526. X      }
  527. X      closedir(d);
  528. X   }
  529. X   if(rflag)
  530. X      free(re);
  531. X}
  532. END_OF_uustatus/findpath.c
  533. if test 2490 -ne `wc -c <uustatus/findpath.c`; then
  534.     echo shar: \"uustatus/findpath.c\" unpacked with wrong size!
  535. fi
  536. # end of overwriting check
  537. fi
  538. if test -f uustatus/findpath.doc -a "${1}" != "-c" ; then 
  539.   echo shar: Will not over-write existing file \"uustatus/findpath.doc\"
  540. else
  541. echo shar: Extracting \"uustatus/findpath.doc\" \(914 characters\)
  542. sed "s/^X//" >uustatus/findpath.doc <<'END_OF_uustatus/findpath.doc'
  543. X
  544. X
  545. X
  546. X     FINDPATH(1)                                           FINDPATH(1)
  547. X
  548. X
  549. X
  550. X     NAME
  551. X          findpath - find file in path path - display path directories
  552. X
  553. X     SYNOPSIS
  554. X          /usr/local/bin/findpath file
  555. X
  556. X     DESCRIPTION
  557. X          Findpath will report on the location of file, searching
  558. X          every directory in the path (as defined in the $PATH
  559. X          variable), much like the operating system does when
  560. X          searching $PATH to execute a program.  It is handy for
  561. X          finding out where in your path a command resides.
  562. X
  563. X          Findpath is linked to path, which simply displays a list of
  564. X          directories to be searched.  It is much faster than 'echo
  565. X          $PATH|tr ":" " "'.
  566. X
  567. X     SEE ALSO
  568. X          csh(1)
  569. X
  570. X     CREDITS
  571. X          This utility was written by Ed Carp.
  572. X
  573. X
  574. X
  575. X
  576. X
  577. X
  578. X
  579. X
  580. X
  581. X
  582. X
  583. X
  584. X
  585. X
  586. X
  587. X
  588. X
  589. X
  590. X
  591. X
  592. X
  593. X
  594. X
  595. X
  596. X
  597. X
  598. X
  599. X
  600. X
  601. X
  602. X
  603. X
  604. X
  605. X     Page 1                                          (printed 1/20/89)
  606. X
  607. X
  608. X
  609. END_OF_uustatus/findpath.doc
  610. if test 914 -ne `wc -c <uustatus/findpath.doc`; then
  611.     echo shar: \"uustatus/findpath.doc\" unpacked with wrong size!
  612. fi
  613. # end of overwriting check
  614. fi
  615. if test -f uustatus/findpath.prt -a "${1}" != "-c" ; then 
  616.   echo shar: Will not over-write existing file \"uustatus/findpath.prt\"
  617. else
  618. echo shar: Extracting \"uustatus/findpath.prt\" \(970 characters\)
  619. sed "s/^X//" >uustatus/findpath.prt <<'END_OF_uustatus/findpath.prt'
  620. X
  621. X
  622. X
  623. X     FINDPATH(1)                                           FINDPATH(1)
  624. X
  625. X
  626. X
  627. X     NAME
  628. X          findpath - find file in path path - display path directories
  629. X
  630. X     SYNOPSIS
  631. X          /usr/local/bin/findpath _f_i_l_e
  632. X
  633. X     DESCRIPTION
  634. X          _F_i_n_d_p_a_t_h will report on the location of _f_i_l_e, searching
  635. X          every directory in the path (as defined in the $PATH
  636. X          variable), much like the operating system does when
  637. X          searching $PATH to execute a program.  It is handy for
  638. X          finding out where in your path a command resides.
  639. X
  640. X          _F_i_n_d_p_a_t_h is linked to _p_a_t_h, which simply displays a list of
  641. X          directories to be searched.  It is much faster than 'echo
  642. X          $PATH|tr ":" " "'.
  643. X
  644. X     SEE ALSO
  645. X          csh(1)
  646. X
  647. X     CREDITS
  648. X          This utility was written by Ed Carp.
  649. X
  650. X
  651. X
  652. X
  653. X
  654. X
  655. X
  656. X
  657. X
  658. X
  659. X
  660. X
  661. X
  662. X
  663. X
  664. X
  665. X
  666. X
  667. X
  668. X
  669. X
  670. X
  671. X
  672. X
  673. X
  674. X
  675. X
  676. X
  677. X
  678. X
  679. X
  680. X
  681. X
  682. X     Page 1                                          (printed 1/20/89)
  683. X
  684. X
  685. X
  686. END_OF_uustatus/findpath.prt
  687. echo shar: 28 control characters may be missing from \"uustatus/findpath.prt\"
  688. if test 970 -ne `wc -c <uustatus/findpath.prt`; then
  689.     echo shar: \"uustatus/findpath.prt\" unpacked with wrong size!
  690. fi
  691. # end of overwriting check
  692. fi
  693. if test -f uustatus/makedocs -a "${1}" != "-c" ; then 
  694.   echo shar: Will not over-write existing file \"uustatus/makedocs\"
  695. else
  696. echo shar: Extracting \"uustatus/makedocs\" \(225 characters\)
  697. sed "s/^X//" >uustatus/makedocs <<'END_OF_uustatus/makedocs'
  698. Xecho Setting up...
  699. Xcc -s -o unback unback.c -O
  700. Xecho Generating uustatus.prt...
  701. Xnroff -man uustatus.1 > uustatus.prt
  702. Xecho Generating uustatus.doc...
  703. Xnroff -man uustatus.1|./unback>uustatus.doc
  704. Xecho Cleaning up...
  705. Xrm -f unback
  706. END_OF_uustatus/makedocs
  707. if test 225 -ne `wc -c <uustatus/makedocs`; then
  708.     echo shar: \"uustatus/makedocs\" unpacked with wrong size!
  709. fi
  710. chmod +x uustatus/makedocs
  711. # end of overwriting check
  712. fi
  713. if test -f uustatus/strrep.fun -a "${1}" != "-c" ; then 
  714.   echo shar: Will not over-write existing file \"uustatus/strrep.fun\"
  715. else
  716. echo shar: Extracting \"uustatus/strrep.fun\" \(1119 characters\)
  717. sed "s/^X//" >uustatus/strrep.fun <<'END_OF_uustatus/strrep.fun'
  718. X/*
  719. X*
  720. X* strrep - replace first occurrence of A with B in string C
  721. X* strrepn - replace nth occurrence of A with B in string C
  722. X*
  723. X* Written by Edwin R. Carp
  724. X*
  725. X* Copyright..oh, who cares!
  726. X*
  727. X*/
  728. X
  729. X#ifndef NULL
  730. X#include <stdio.h>
  731. X#endif
  732. X
  733. Xchar *strrep(a, b, c) /* replace first a with b in string c */
  734. Xchar *a, *b, *c;
  735. X{
  736. X   char *pd;
  737. X   static char d[512]; /* yes, yes, could be fancier, I know! */
  738. X
  739. X   *d = NULL;
  740. X   pd = d;
  741. X   while(*c)
  742. X   {
  743. X      if(strncmp(a, c, strlen(a)) == 0) break;
  744. X      *pd++ = *c++;
  745. X   }
  746. X   if(!*c) return((char *)EOF); /* a not found in c */
  747. X   *pd = NULL;
  748. X   strcat(d, b);
  749. X   strcat(d, c+strlen(a));
  750. X   return(d);
  751. X}
  752. X
  753. Xchar *strrepn(a, b, c, n) /* replace nth a with b in string c */
  754. Xchar *a, *b, *c;
  755. Xint n;
  756. X{
  757. X   char *pd;
  758. X   static char d[512]; /* yes, yes, could be fancier, I know! */
  759. X   int i=0;
  760. X
  761. X   if(n < 1) return((char *)EOF);
  762. X   *d = NULL;
  763. X   pd = d;
  764. X   while(*c)
  765. X   {
  766. X      if(strncmp(a, c, strlen(a)) == 0) i++;
  767. X      if(i == n) break;
  768. X      *pd++ = *c++;
  769. X   }
  770. X   if(!*c) return((char *)EOF); /* a not found in c */
  771. X   *pd = NULL;
  772. X   strcat(d, b);
  773. X   strcat(d, c+strlen(a));
  774. X   return(d);
  775. X}
  776. END_OF_uustatus/strrep.fun
  777. if test 1119 -ne `wc -c <uustatus/strrep.fun`; then
  778.     echo shar: \"uustatus/strrep.fun\" unpacked with wrong size!
  779. fi
  780. # end of overwriting check
  781. fi
  782. if test -f uustatus/touch.fun -a "${1}" != "-c" ; then 
  783.   echo shar: Will not over-write existing file \"uustatus/touch.fun\"
  784. else
  785. echo shar: Extracting \"uustatus/touch.fun\" \(380 characters\)
  786. sed "s/^X//" >uustatus/touch.fun <<'END_OF_uustatus/touch.fun'
  787. X/*
  788. X*
  789. X* touch - (can't you tell?)
  790. X*
  791. X* Written by Edwin R. Carp
  792. X*
  793. X* Copyright...(this is getting old!)
  794. X*
  795. X*/
  796. X
  797. Xint touch(file)
  798. Xchar *file;
  799. X{
  800. X   time_t timea[2];
  801. X   FILE *f;
  802. X
  803. X   if(access(file, 0) == EOF)
  804. X   {
  805. X      if((f=fopen(file, "w")) == (FILE *)NULL) return(EOF);
  806. X      fclose(f);
  807. X      return(NULL);
  808. X   }
  809. X   time(&timea[0]);
  810. X   time(&timea[1]);
  811. X   return(utime(file, timea));
  812. X}
  813. END_OF_uustatus/touch.fun
  814. if test 380 -ne `wc -c <uustatus/touch.fun`; then
  815.     echo shar: \"uustatus/touch.fun\" unpacked with wrong size!
  816. fi
  817. # end of overwriting check
  818. fi
  819. if test -f uustatus/unback.c -a "${1}" != "-c" ; then 
  820.   echo shar: Will not over-write existing file \"uustatus/unback.c\"
  821. else
  822. echo shar: Extracting \"uustatus/unback.c\" \(711 characters\)
  823. sed "s/^X//" >uustatus/unback.c <<'END_OF_uustatus/unback.c'
  824. Xstatic char *sccsid = "%Z% %M% %I%    %G% %U%";
  825. X/*
  826. X*
  827. X* unback <input >output
  828. X*
  829. X* unback will make the output of nroff readable from a file
  830. X*
  831. X* written 05/14/87 by Ed Carp
  832. X*
  833. X*/
  834. X#define BACKSPACE 8
  835. X#define EOF (-1)
  836. Xmain()
  837. X{
  838. X   char in[3], c;
  839. X   int i;
  840. X
  841. X   in[0] = in[1] = in[2] = '\0';
  842. X   while((c=getchar()) != EOF)
  843. X   {
  844. X      if(in[0] != '\0') putchar(in[0]);
  845. X      in[0] = in[1];
  846. X      in[1] = in[2];
  847. X      in[2] = c;
  848. X      if(in[0] == '_' && in[1] == BACKSPACE)
  849. X      {
  850. X         in[0] = in[1] = '\0';
  851. X         continue;
  852. X      }
  853. X      if(in[0] != '_' && in[1] == BACKSPACE)
  854. X      {
  855. X         in[1] = in[2] = '\0';
  856. X         continue;
  857. X      }
  858. X   }
  859. X   for(i=0; i<3; i++)
  860. X      if(in[i] != '\0') putchar(in[i]);
  861. X}
  862. X
  863. END_OF_uustatus/unback.c
  864. if test 711 -ne `wc -c <uustatus/unback.c`; then
  865.     echo shar: \"uustatus/unback.c\" unpacked with wrong size!
  866. fi
  867. # end of overwriting check
  868. fi
  869. if test -f uustatus/uustatus.1 -a "${1}" != "-c" ; then 
  870.   echo shar: Will not over-write existing file \"uustatus/uustatus.1\"
  871. else
  872. echo shar: Extracting \"uustatus/uustatus.1\" \(591 characters\)
  873. sed "s/^X//" >uustatus/uustatus.1 <<'END_OF_uustatus/uustatus.1'
  874. X.TH UUSTATUS 1L "January 25, 1989" "Version 1.1"
  875. X.ad b
  876. X.SH NAME
  877. Xuustatus \- check UUCP status on HDB systems
  878. X.SH SYNOPSIS
  879. Xuustatus
  880. X.SH DESCRIPTION
  881. X.I Uustatus
  882. Xwill dynamically display the status of ongoing and failed UUCP connections.
  883. XIt is intended to be used with the HDB (HoneyDanBer) UUCP system.
  884. X.SH PORTING
  885. XThis utility was written for System V; however it should run "as is" on
  886. XBSD systems.
  887. X.SH NOTES
  888. XAs distributed, this utility will not display statistics concerning
  889. Xfailed UUCP connections due to "WRONG TIME TO CALL" errors.
  890. X.SH CREDITS
  891. XThis utility was written by Edwin R. Carp.
  892. END_OF_uustatus/uustatus.1
  893. if test 591 -ne `wc -c <uustatus/uustatus.1`; then
  894.     echo shar: \"uustatus/uustatus.1\" unpacked with wrong size!
  895. fi
  896. # end of overwriting check
  897. fi
  898. if test -f uustatus/uustatus.c -a "${1}" != "-c" ; then 
  899.   echo shar: Will not over-write existing file \"uustatus/uustatus.c\"
  900. else
  901. echo shar: Extracting \"uustatus/uustatus.c\" \(11353 characters\)
  902. sed "s/^X//" >uustatus/uustatus.c <<'END_OF_uustatus/uustatus.c'
  903. X/*
  904. X*
  905. X* uustatus - display UUCP communications status for HDB systems
  906. X*
  907. X* usage: uustatus [-o] [-b] [-u]
  908. X*
  909. X* Written 01/19/89 by Ed Carp
  910. X*
  911. X* Copyright 1989, by Edwin R. Carp
  912. X*
  913. X* Version     Date     Status       Comments
  914. X*
  915. X*  1.0.c    01/21/89   INTERNAL     IO display, number of IO msgs, uucico log
  916. X*                                   file display, <sys/types.h> include.
  917. X*
  918. X*  1.0.d    01/24/89   PREREL       tails first system talking instead of
  919. X*                                   last, displays star on system tailed,
  920. X*                                   improved method of tailing log files,
  921. X*                                   create status files if they don't exist.
  922. X*                                   now should be owned by uucp or nuucp.
  923. X*
  924. X*  1.1      01/25/89   RELEASE      Released version to USENET.
  925. X*
  926. X*  1.1.a    01/26/89   PREREL       Fixed XENIX defines.
  927. X*
  928. X*  1.1.b    01/28/89   PREREL       Display time/date.
  929. X*
  930. X*  1.1.c    02/03/87   PREREL       Added -b, -o options.
  931. X*
  932. X*  1.1.d    03/02/89   PREREL       Took out 2 second wait before init.
  933. X*
  934. X*  1.1.e    03/08/89   PREREL       -u option kicks off uucico for sites that
  935. X*                                   have files.
  936. X*
  937. X*  1.1.f    12/04/89   REPOST       Fixes case where program dumps core if
  938. X*                                   log file goes away while program is running.
  939. X*
  940. X*/
  941. X
  942. Xchar *sccsid = "uustatus, version 1.1.f  12/04/89  Copyright 1989 by Edwin R. Carp";
  943. X#include <stdio.h>
  944. X#include <sys/types.h>
  945. X#include <curses.h>
  946. X#ifdef hpux || M_XENIX
  947. X#include <sys/ndir.h>
  948. X#define dirent direct
  949. X#else
  950. X#include <dirent.h>
  951. X#endif
  952. X#include <time.h>
  953. X#include <signal.h>
  954. X#define YES 1
  955. X#define NO 0
  956. X#include "uustatus.h"
  957. X#include "basename.fun"
  958. X#include "touch.fun"
  959. X
  960. XDIR *din, *win;
  961. Xstruct dirent *dp, *dpw;
  962. XFILE *in, *exp;
  963. XFILE *tin;
  964. Xchar ltname[64];
  965. Xchar tline[24][80];
  966. Xextern char *optarg;
  967. Xextern int optind, opterr;
  968. Xint bflag=0, oflag=0;
  969. X
  970. Xmain(argc, argv)
  971. Xint argc;
  972. Xchar **argv;
  973. X{
  974. X   char line[512], lock[64], cretries[6], *lptr;
  975. X   char cfiles[6], work[64], name[25], tname[64], c;
  976. X   int i, status, ifiles, ofiles, files, retries, bye();
  977. X   int systems, expflag, display, ret, tnameset=0;
  978. X   int uflag=0;
  979. X   long secs, retryt, curr;
  980. X   struct tm *t1, *t2;
  981. X
  982. X   while((c=getopt(argc, argv, "bou")) != (char)EOF)
  983. X   {
  984. X      switch(c)
  985. X      {
  986. X      case 'b': /* beep on conversation */
  987. X         bflag = 1;
  988. X         break;
  989. X      case 'o': /* oneshot - no curses */
  990. X         oflag = 1;
  991. X         break;
  992. X      case 'u': /* start uucico for each site that has files */
  993. X         uflag = 1;
  994. X         oflag = 1;
  995. X         break;
  996. X      }
  997. X   }
  998. X   if(!uflag) fprintf(stderr, "%s\n", sccsid);
  999. X   chdir(STATUS);
  1000. X   for(i=1; i<4; i++)
  1001. X      signal(i, bye);
  1002. X   if(LOGON) exp = fopen(LOGFILE, "w");
  1003. X   *ltname = NULL;
  1004. X   /* create status files if they don't exist */
  1005. X   if((in=fopen(SYSTEMS, "r")) == (FILE *)NULL)
  1006. X      perror(SYSTEMS);
  1007. X   else
  1008. X   {
  1009. X      while(fgets(line, 510, in) != (char *)NULL)
  1010. X      {
  1011. X         lptr = line;
  1012. X         while(*lptr == ' ' || *lptr == TABCHAR) lptr++;
  1013. X         if(*lptr == '#') continue;
  1014. X         while(*lptr != ' ' && *lptr != TABCHAR && *lptr != NULL) lptr++;
  1015. X         *lptr = NULL;
  1016. X         ofiles = ifiles = files = 0;
  1017. X         sprintf(work, WORKFILE, line);
  1018. X         if((win=opendir(work)) != (DIR *)NULL)
  1019. X         {
  1020. X            /* count the number of C., TM., and X. files */
  1021. X            while((dp=readdir(win)) != (struct dirent *)NULL)
  1022. X            {
  1023. X               if(strncmp(dp->d_name, "C.", 2) == 0) ofiles++;
  1024. X               if(strncmp(dp->d_name, "X.", 2) == 0) ifiles++;
  1025. X               if(strncmp(dp->d_name, "TM.", 3) == 0) ifiles++;
  1026. X               if(ifiles+ofiles > FLIMIT) break;
  1027. X            }
  1028. X            closedir(win);
  1029. X         }
  1030. X         if(access(line, 0) != 0 && (ifiles > 0 || ofiles > 0))
  1031. X         {
  1032. X            if((tin=fopen(line, "w")) == (FILE *)NULL)
  1033. X            {
  1034. X               perror(line);
  1035. X               continue;
  1036. X            }
  1037. X            fprintf(tin, "24 0 %ld 0 %s", time(0L), errortext[24]);
  1038. X            fclose(tin);
  1039. X            chmod(line, 0666);
  1040. X            chown(line, UUCPOWN, UUCPGRP);
  1041. X         }
  1042. X         if(uflag && ofiles > 0)
  1043. X         {
  1044. X            sprintf(work, "/usr/lib/uucp/uucico -r1 -s%s", line);
  1045. X            system(work);
  1046. X         }
  1047. X      }
  1048. X      fclose(in);
  1049. X   }
  1050. X   if(uflag) exit(0);
  1051. X   fflush(stdout);
  1052. X   if(oflag == 0)
  1053. X      initscr();
  1054. X   while(1)
  1055. X   {
  1056. X      if(oflag == 0) move(0, 0);
  1057. X      if((din=opendir(".")) == (DIR *)NULL)
  1058. X      {
  1059. X         perror(STATUS);
  1060. X         exit(1);
  1061. X      }
  1062. X      if(oflag == 0)
  1063. X         printw("SYSTEM       RETRY IO FIL   LAST TRY     NEXT TRY    STATUS    ");
  1064. X      else
  1065. X         printf("SYSTEM       RETRY IO FIL   LAST TRY     NEXT TRY    STATUS    ");
  1066. X      time(&curr);
  1067. X      t1 = localtime(&curr);
  1068. X      if(oflag == 0)
  1069. X         printw("%02d/%02d %02d:%02d  ",
  1070. X             t1->tm_mon+1, t1->tm_mday, t1->tm_hour, t1->tm_min);
  1071. X      else
  1072. X         printf("%02d/%02d %02d:%02d\n\n",
  1073. X             t1->tm_mon+1, t1->tm_mday, t1->tm_hour, t1->tm_min);
  1074. X      if(LOGON) fprintf(exp, "%s", ctime(&curr));
  1075. X      display = systems = 0;
  1076. X      if(oflag == 0)
  1077. X      {
  1078. X         move(0, COLS-(1+strlen(WAITMSG)));
  1079. X         standout();
  1080. X         addstr(WAITMSG);
  1081. X         standend();
  1082. X         move(1, 0);
  1083. X         refresh();
  1084. X         clrtobot();
  1085. X      }
  1086. X      *tname = NULL;
  1087. X      while((dp=readdir(din)) != (struct dirent *)NULL)
  1088. X      {
  1089. X         if(display > LLIMIT && oflag == 0) break;
  1090. X         if(*dp->d_name == '.') continue;
  1091. X         systems++;
  1092. X         if((in=fopen(dp->d_name, "r")) == (FILE *)NULL) continue;
  1093. X         fgets(line, 510, in);
  1094. X         fclose(in);
  1095. X         line[strlen(line)-1] = NULL;
  1096. X         sscanf(line, "%d %d %ld %ld", &status, &retries, &secs, &retryt);
  1097. X         expflag = 0;
  1098. X         strcpy(name, dp->d_name);
  1099. X         if((curr - secs) > ((long)EXPDAYS*(long)24*(long)60*(long)60))
  1100. X         {
  1101. X            if(LOGON) fprintf(exp, "%s EXPIRED! (%ld - %ld) > %ld\n",
  1102. X                name, curr, secs,
  1103. X                ((long)EXPDAYS*(long)24*(long)60*(long)60));
  1104. X            expflag = 1;
  1105. X         }
  1106. X         sprintf(lock, LOCKFILE, name);
  1107. X         sprintf(work, WORKFILE, name);
  1108. X         ofiles = ifiles = files = 0;
  1109. X         if((win=opendir(work)) != (DIR *)NULL)
  1110. X         {
  1111. X            /* count the number of C., TM., and X. files */
  1112. X            while((dp=readdir(win)) != (struct dirent *)NULL)
  1113. X            {
  1114. X               if(strncmp(dp->d_name, "C.", 2) == 0) ofiles++;
  1115. X               if(strncmp(dp->d_name, "X.", 2) == 0) ifiles++;
  1116. X               if(strncmp(dp->d_name, "TM.", 3) == 0) ifiles++;
  1117. X               if(ifiles+ofiles > FLIMIT) break;
  1118. X            }
  1119. X            closedir(win);
  1120. X         }
  1121. X         files = ifiles + ofiles;
  1122. X         if(files != 0) sprintf(cfiles, "%d", files);
  1123. X         else strcpy(cfiles, "   ");
  1124. X         if(files > FLIMIT) sprintf(cfiles, "%d+", FLIMIT);
  1125. X         if(retries != 0) sprintf(cretries, "%d", retries);
  1126. X         else strcpy(cretries, "   ");
  1127. X         /* kludges for screwy status stuff with HDB */
  1128. X         if(access(lock, 0) == 0 && status != 3) status = 22;
  1129. X         if(status == 11) status = 13; /* fix bug */
  1130. X         /* skip WRONG TIME TO CALL  and STATUS UNKNOWN messages */
  1131. X#ifndef WTTC
  1132. X         if((status == 23 || status == 2) && files == 0)
  1133. X            continue;
  1134. X#endif
  1135. X         t1 = localtime(&secs);
  1136. X         retryt += secs;
  1137. X         t2 = localtime(&retryt);
  1138. X         move(display+2, 0);
  1139. X         if(expflag == 0)
  1140. X         {
  1141. X            if(oflag == 0)
  1142. X               printw("%-14s  %-3s%c%c %-3s ",
  1143. X                   name, cretries, ifiles==0?' ':'I', ofiles==0?' ':'O', cfiles);
  1144. X            else
  1145. X               printf("%-14s  %-3s%c%c %-3s ",
  1146. X                   name, cretries, ifiles==0?' ':'I', ofiles==0?' ':'O', cfiles);
  1147. X         }
  1148. X         else if(LOGON) fprintf(exp, "%-14s  %-3d ", name, retries);
  1149. X         t1 = localtime(&secs);
  1150. X         if(expflag == 0)
  1151. X         {
  1152. X            if(oflag == 0)
  1153. X               printw("%02d/%02d %02d:%02d  ",
  1154. X                   t1->tm_mon+1, t1->tm_mday, t1->tm_hour, t1->tm_min);
  1155. X            else
  1156. X               printf("%02d/%02d %02d:%02d  ",
  1157. X                   t1->tm_mon+1, t1->tm_mday, t1->tm_hour, t1->tm_min);
  1158. X         }
  1159. X         else if(LOGON) fprintf(exp, "%02d/%02d %02d:%02d  ",
  1160. X             t1->tm_mon+1, t1->tm_mday, t1->tm_hour, t1->tm_min);
  1161. X         t2 = localtime(&retryt);
  1162. X         if(expflag == 0)
  1163. X         {
  1164. X            if(oflag == 0)
  1165. X               printw("%02d/%02d %02d:%02d ",
  1166. X                   t2->tm_mon+1, t2->tm_mday, t2->tm_hour, t2->tm_min);
  1167. X            else
  1168. X               printf("%02d/%02d %02d:%02d ",
  1169. X                   t2->tm_mon+1, t2->tm_mday, t2->tm_hour, t2->tm_min);
  1170. X         }
  1171. X         else if(LOGON) fprintf(exp, "%02d/%02d %02d:%02d  ",
  1172. X             t2->tm_mon+1, t2->tm_mday, t2->tm_hour, t2->tm_min);
  1173. X         if(status == 3 || status == 22)
  1174. X         {
  1175. X            if(tnameset == 0)
  1176. X            {
  1177. X               sprintf(tname, UUCICO, name);
  1178. X               tnameset = 1;
  1179. X               if(oflag == 0) printw("* ");
  1180. X               else printf("* ");
  1181. X            }
  1182. X            else
  1183. X            {
  1184. X               if(oflag == 0) printw("  ");
  1185. X               else printf("  ");
  1186. X            }
  1187. X            if(oflag == 0) standout();
  1188. X         }
  1189. X         else
  1190. X         {
  1191. X            if(oflag == 0) printw("  ");
  1192. X            else printf("  ");
  1193. X         }
  1194. X         if(expflag == 0)
  1195. X         {
  1196. X            if(oflag == 0) printw("%s\n", errortext[status]);
  1197. X            else printf("%s\n", errortext[status]);
  1198. X         }
  1199. X         else if(LOGON) fprintf(exp, "%s\n", errortext[status]);
  1200. X         if((status == 3 || status == 22) && oflag == 0) standend();
  1201. X         display++;
  1202. X      }
  1203. X      tnameset = 0;
  1204. X      if(oflag == 1) break; /* once only */
  1205. X      printw("\n%d UUCP connections active", systems);
  1206. X      ret = tailfile(tname, display+5, LINES);
  1207. X      move(0, COLS-(1+strlen(BWAITMSG)));
  1208. X      addstr(BWAITMSG);
  1209. X      move(1, 0);
  1210. X      refresh();
  1211. X      closedir(din);
  1212. X      if(ret == NULL)
  1213. X         sleep(1);
  1214. X      else
  1215. X         sleep(SLEEPTIME);
  1216. X   }
  1217. X}
  1218. Xbye(sig)
  1219. Xint sig;
  1220. X{
  1221. X   if(LOGON) fclose(exp);
  1222. X   endwin();
  1223. X   exit(0);
  1224. X}
  1225. X
  1226. Xtailfile(s, from, to) /* returns NULL if done, EOF if error */
  1227. Xchar *s;
  1228. Xint from, to;
  1229. X{
  1230. X   char wrk[512];
  1231. X   int i;
  1232. X
  1233. X   move(from, 0);
  1234. X   clrtobot();
  1235. X   if(*s == NULL) return(EOF);
  1236. X   if(access(s, 0) == EOF) return(EOF);
  1237. X   if(strcmp(s, ltname) != 0)
  1238. X   {
  1239. X      fclose(tin);
  1240. X      strcpy(ltname, s);
  1241. X      if((tin=fopen(s, "r")) == (FILE *)NULL) return(EOF);
  1242. X      /* display the last (to-from) lines of file s */
  1243. X      /* must be limited to COLS */
  1244. X      for(i=0; i<(to-from)-1; i++) *tline[i] = NULL;
  1245. X   }
  1246. X   while(fgets(wrk, 510, tin) != (char *)NULL)
  1247. X   {
  1248. X      if( '\n' != wrk[strlen(wrk)-1])
  1249. X      {
  1250. X         sleep(1);
  1251. X         fseek(tin, (long)strlen(wrk), 1);
  1252. X         continue;
  1253. X      }
  1254. X      wrk[strlen(wrk)-1] = NULL;
  1255. X      for(i=0; i<(to-from)-1; i++) strcpy(tline[i], tline[i+1]);
  1256. X      strcpy(tline[(to-from)-1],
  1257. X          strlen(wrk)>COLS-1?wrk+(strlen(wrk)-(COLS-1)):wrk);
  1258. X   }
  1259. X   move(from-1, 20);
  1260. X   standout();
  1261. X   addstr(s);
  1262. X   if(bflag) printf("\7");
  1263. X   standend();
  1264. X   move(from, 0);
  1265. X   for(i=0; i<to-from; i++)
  1266. X   {
  1267. X      if(strlen(tline[i]) > COLS-1)
  1268. X         printw("%s\n", tline[i] + (strlen(tline[i]) - (COLS-1)));
  1269. X      else printw("%s\n", tline[i]);
  1270. X   }
  1271. X   return(NULL);
  1272. X}
  1273. END_OF_uustatus/uustatus.c
  1274. if test 11353 -ne `wc -c <uustatus/uustatus.c`; then
  1275.     echo shar: \"uustatus/uustatus.c\" unpacked with wrong size!
  1276. fi
  1277. # end of overwriting check
  1278. fi
  1279. if test -f uustatus/uustatus.doc -a "${1}" != "-c" ; then 
  1280.   echo shar: Will not over-write existing file \"uustatus/uustatus.doc\"
  1281. else
  1282. echo shar: Extracting \"uustatus/uustatus.doc\" \(847 characters\)
  1283. sed "s/^X//" >uustatus/uustatus.doc <<'END_OF_uustatus/uustatus.doc'
  1284. X
  1285. X
  1286. X
  1287. X     UUSTATUS(1L)               Version 1.1               UUSTATUS(1L)
  1288. X
  1289. X
  1290. X
  1291. X     NAME
  1292. X          uustatus - check UUCP status on HDB systems
  1293. X
  1294. X     SYNOPSIS
  1295. X          uustatus
  1296. X
  1297. X     DESCRIPTION
  1298. X          Uustatus will dynamically display the status of ongoing  and
  1299. X          failed UUCP connections.  It is intended to be used with the
  1300. X          HDB (HoneyDanBer) UUCP system.
  1301. X
  1302. X     PORTING
  1303. X          This utility was written for System V; however it should run
  1304. X          "as is" on BSD systems.
  1305. X
  1306. X     NOTES
  1307. X          As distributed, this utility  will  not  display  statistics
  1308. X          concerning  failed  UUCP  connections  due to "WRONG TIME TO
  1309. X          CALL" errors.
  1310. X
  1311. X     CREDITS
  1312. X          This utility was written by Edwin R. Carp.
  1313. X
  1314. X
  1315. X
  1316. X
  1317. X
  1318. X
  1319. X
  1320. X
  1321. X
  1322. X
  1323. X
  1324. X
  1325. X
  1326. X
  1327. X
  1328. X
  1329. X
  1330. X
  1331. X
  1332. X
  1333. X
  1334. X
  1335. X
  1336. X
  1337. X
  1338. X
  1339. X
  1340. X
  1341. X
  1342. X
  1343. X
  1344. X
  1345. X
  1346. X     Page 1                 (January 25, 1989)       (printed 1/25/89)
  1347. X
  1348. X
  1349. X
  1350. END_OF_uustatus/uustatus.doc
  1351. if test 847 -ne `wc -c <uustatus/uustatus.doc`; then
  1352.     echo shar: \"uustatus/uustatus.doc\" unpacked with wrong size!
  1353. fi
  1354. # end of overwriting check
  1355. fi
  1356. if test -f uustatus/uustatus.h -a "${1}" != "-c" ; then 
  1357.   echo shar: Will not over-write existing file \"uustatus/uustatus.h\"
  1358. else
  1359. echo shar: Extracting \"uustatus/uustatus.h\" \(1600 characters\)
  1360. sed "s/^X//" >uustatus/uustatus.h <<'END_OF_uustatus/uustatus.h'
  1361. X/*
  1362. X*
  1363. X* tuneable parameters
  1364. X*
  1365. X*/
  1366. X
  1367. X/* #define WTTC */
  1368. X#define STATUS "/usr/spool/uucp/.Status"
  1369. X#define SYSTEMS "/usr/lib/uucp/Systems"
  1370. X#define UUCICO "/usr/spool/uucp/.Log/uucico/%s"
  1371. X#define LOCKFILE "/usr/spool/uucp/LCK..%s"
  1372. X#define WORKFILE "/usr/spool/uucp/%s"
  1373. X#define EXPDAYS 999 /* connections older than X days will not be displayed */
  1374. X#define LOGON NO /* log expired systems? */
  1375. X#define LOGFILE "/tmp/uuexp.log"
  1376. X#define WAITMSG "WAIT"
  1377. X#define BWAITMSG "    " /* blank wait msg string */
  1378. X#define LLIMIT LINES-5
  1379. X#define FLIMIT 999 /* over this many files for site, we quit; should be < 100 */
  1380. X#define SLEEPTIME 5 /* time to sleep between samples */
  1381. X#define UUCPOWN "uucp" /* uucp owner */
  1382. X#define UUCPGRP "uucp" /* uucp group */
  1383. X#define TABCHAR '    ' /* should be a TAB */
  1384. X
  1385. X/*
  1386. X*
  1387. X* end of tuneable parameters
  1388. X*
  1389. X*/
  1390. X
  1391. Xchar *errortext[] =
  1392. X{
  1393. X   "SUCCESSFUL",
  1394. X   "NO DEVICES AVAILABLE",
  1395. X   "WRONG TIME TO CALL",
  1396. X   "TALKING",
  1397. X   "CONVERSATION FAILED",
  1398. X   "BAD SEQUENCE CHECK",
  1399. X   "LOGIN FAILED",
  1400. X   "DIAL FAILED",
  1401. X   "BAD LOGIN/MACHINE COMBINATION",
  1402. X   "DEVICE LOCKED",
  1403. X   "ASSERT ERROR",
  1404. X   "SYSTEM NOT IN Systems FILE",
  1405. X   "CAN'T ACCESS DEVICE",
  1406. X   "DEVICE FAILED",
  1407. X   "WRONG MACHINE NAME",
  1408. X   "CALLBACK REQUIRED",
  1409. X   "REMOTE HAS A LCK FILE FOR ME",
  1410. X   "REMOTE DOES NOT KNOW ME",
  1411. X   "REMOTE REJECT AFTER LOGIN",
  1412. X   "REMOTE REJECT, UNKNOWN MESSAGE",
  1413. X   "STARTUP FAILED",
  1414. X   "BUSY OR NO ANSWER",
  1415. X/* #ifdef M_XENIX */
  1416. X   /* "EXECDIAL LOCAL FAILURE", */
  1417. X   /* "EXECDIAL REMOTE FAILURE", */
  1418. X   /* "STATUS UNKNOWN", */
  1419. X/* #else */
  1420. X   "CALL IN PROGRESS",
  1421. X   "", /* dummy */
  1422. X   "STATUS UNKNOWN",
  1423. X/* #endif */
  1424. X};
  1425. END_OF_uustatus/uustatus.h
  1426. if test 1600 -ne `wc -c <uustatus/uustatus.h`; then
  1427.     echo shar: \"uustatus/uustatus.h\" unpacked with wrong size!
  1428. fi
  1429. # end of overwriting check
  1430. fi
  1431. if test -f uustatus/uustatus.prt -a "${1}" != "-c" ; then 
  1432.   echo shar: Will not over-write existing file \"uustatus/uustatus.prt\"
  1433. else
  1434. echo shar: Extracting \"uustatus/uustatus.prt\" \(863 characters\)
  1435. sed "s/^X//" >uustatus/uustatus.prt <<'END_OF_uustatus/uustatus.prt'
  1436. X
  1437. X
  1438. X
  1439. X     UUSTATUS(1L)               Version 1.1               UUSTATUS(1L)
  1440. X
  1441. X
  1442. X
  1443. X     NAME
  1444. X          uustatus - check UUCP status on HDB systems
  1445. X
  1446. X     SYNOPSIS
  1447. X          uustatus
  1448. X
  1449. X     DESCRIPTION
  1450. X          _U_u_s_t_a_t_u_s will dynamically display the status of ongoing  and
  1451. X          failed UUCP connections.  It is intended to be used with the
  1452. X          HDB (HoneyDanBer) UUCP system.
  1453. X
  1454. X     PORTING
  1455. X          This utility was written for System V; however it should run
  1456. X          "as is" on BSD systems.
  1457. X
  1458. X     NOTES
  1459. X          As distributed, this utility  will  not  display  statistics
  1460. X          concerning  failed  UUCP  connections  due to "WRONG TIME TO
  1461. X          CALL" errors.
  1462. X
  1463. X     CREDITS
  1464. X          This utility was written by Edwin R. Carp.
  1465. X
  1466. X
  1467. X
  1468. X
  1469. X
  1470. X
  1471. X
  1472. X
  1473. X
  1474. X
  1475. X
  1476. X
  1477. X
  1478. X
  1479. X
  1480. X
  1481. X
  1482. X
  1483. X
  1484. X
  1485. X
  1486. X
  1487. X
  1488. X
  1489. X
  1490. X
  1491. X
  1492. X
  1493. X
  1494. X
  1495. X
  1496. X
  1497. X
  1498. X     Page 1                 (January 25, 1989)       (printed 1/25/89)
  1499. X
  1500. X
  1501. X
  1502. END_OF_uustatus/uustatus.prt
  1503. echo shar: 8 control characters may be missing from \"uustatus/uustatus.prt\"
  1504. if test 863 -ne `wc -c <uustatus/uustatus.prt`; then
  1505.     echo shar: \"uustatus/uustatus.prt\" unpacked with wrong size!
  1506. fi
  1507. # end of overwriting check
  1508. fi
  1509. echo shar: End of shell archive.
  1510. exit 0
  1511. ----------------------------------- cut here -----------------------------------
  1512.            Ed Carp    N7EKG/5 (28.3-28.5)    erc@puzzle!khijol
  1513.            Austin,  Tx; (home) (512) 445-2044
  1514.            Snail Mail:  1800 E. Stassney  #1205
  1515.                         Austin, Tx  78744
  1516.  
  1517.  
  1518.